<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="net.gettoweb.contact.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

<%
	
    // ArrayList<Contact> contacts = ContactService.getAllContacts();
	ArrayList<Contact> contacts = new ArrayList<Contact>();
	contacts.add(new Contact(1,"李强","男","13023451654"));
	contacts.add(new Contact(2,"张小燕","女","13087908754"));
	contacts.add(new Contact(3,"李名","男","13888798907"));
	contacts.add(new Contact(4,"王小明","男","13778908766"));
	contacts.add(new Contact(5,"徐燕","女","13887576789"));
%>
<h1>联系人管理</h1>
<a href="">添加联系人</a>
<br />
<form>
<input type="text" placeholder="请输入姓名关键字">
<input type="submit" value="搜索">
</form>
<br/>
	<table border="1">
		<thead>
			<tr>
				<th>编号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>手机</th>
				<th></th>
			</tr>
		</thead>
		<tbody>
		<% Iterator<Contact> it = contacts.iterator();
		   while(it.hasNext()){	
			   Contact c = it.next();
		%>
			<tr>
				<td><%= c.getId() %></td>
				<td><%= c.getName() %></td>
				<td><%= c.getGender() %></td>
				<td><%= c.getMobile() %></td>
				<td><a href="/edit.jsp?id=<%= c.getId() %>">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/delete.jsp?id=<%= c.getId() %>">删除</a></td>
			</tr>
		<% } %>	
		</tbody>	
	</table>
</body>
</html>